package seven.test_7_16;

import java.util.Scanner;

public class TestMain {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int m = scanner.nextInt();
        int n = scanner.nextInt();
        int[][] dp = new int[m + 1][n + 1];
        scanner.nextLine();
        for (int i = 0; i < m; i++) {
            String str = scanner.nextLine();
            for (int j = 0; j < str.length(); j++) {
                char c = str.charAt(j);
                dp[i+1][j+1] = Math.max(dp[i][j + 1],dp[i + 1][j]);
                if(c == 'l') {
                    dp[i + 1][j + 1] += 4;
                } else if(c == 'o') {
                    dp[i + 1][j + 1] += 3;
                } else if (c == 'v') {
                    dp[i + 1][j + 1] += 2;
                } else if (c == 'e') {
                    dp[i + 1][j + 1] += 1;
                }
            }
        }
        System.out.println(dp[m][n]);
    }
}
